package com.changhongit.dao.impl;



import java.util.List;

import org.springframework.stereotype.Repository;

import com.changhongit.base.impl.BaseDaoImpl;
import com.changhongit.dao.ServiceProviderDao;
import com.changhongit.entity.ServiceProvider;
import com.changhongit.returnentity.ReturnServiceProvider;


@Repository("serviceProviderDao")
public class ServiceProviderDaoImpl extends BaseDaoImpl<ServiceProvider> implements ServiceProviderDao
{

	public List<ServiceProvider> findAll() {
		return getSqlSession().selectList("serviceprovider.findAll");
	}
	
	public void saveServiceProvider(ServiceProvider serviceProvider) {
		getSqlSession().insert("serviceprovider.update", serviceProvider);
	}

	public void deleteServiceProvider(String id) {
		getSqlSession().delete("serviceprovider.deleteProduct", id);
	}

	@Override
	public ServiceProvider findOneByName(String name) {
		return getSqlSession().selectOne("serviceprovider.findOneByName", name);
	}

	@Override
	public ServiceProvider findOneByUserName(String userName) {
		return getSqlSession().selectOne("serviceprovider.findOneByUserName", userName);
	}

	@Override
	public void updateFlags(ServiceProvider serviceProvider) {
		getSqlSession().update("serviceprovider.updateFlags",serviceProvider);
	}

	@Override
	public List<ReturnServiceProvider> findAllServiceProviders(ReturnServiceProvider returnServiceProvider) {
		return getSqlSession().selectList("serviceprovider.findAllServiceProviders",returnServiceProvider);
	}

	@Override
	public void getCallNum() {
		getSqlSession().selectList("serviceprovider.getCallNum");
	}
	
	
}
